﻿SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[GameEntity]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[GameEntity](
	[GameID] [int] NOT NULL,
	[EntityID] [int] NOT NULL,
	[ParentGameEntityID] [int] NULL,
	[GameRoleID] [int] NULL,
	[Visible] [bit] NOT NULL,
 CONSTRAINT [PK_GameEntity] PRIMARY KEY CLUSTERED 
(
	[GameID] ASC,
	[EntityID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO

IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'GameEntity' AND COLUMN_NAME = 'OrderNumber')
ALTER TABLE [dbo].[GameEntity]
	ADD [OrderNumber] int null 

 